package com.blacktry.entity.schedule;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;

import com.blacktry.entity.schedule.ScheduleJob;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 
 * </p>
 *
 * @author blackTry
 * @since 2022-02-02
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="ScheduleLog对象", description="")
public class ScheduleLog implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "定时任务的id")
    private String jobId;

    private String jobName;

    @ApiModelProperty(value = "任务执行的类")
    private String jobClazz;

    @ApiModelProperty(value = "1 成功 2 异常 ")
    private Integer status;

    @ApiModelProperty(value = "描述")
    private String logInfo;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @DateTimeFormat( pattern = "yyyy-MM-dd HH:mm:ss")
    private Long createTime;


    public ScheduleLog(ScheduleJob scheduleJob, int status, String logInfo) {
        this.jobId = scheduleJob.getId().toString();
        this.jobName = scheduleJob.getName();
        this.jobClazz = scheduleJob.getClazz();
        this.status = status;
        this.logInfo = logInfo;
    }
}
